package com.java.service.impl;

import com.java.entity.Pickingmanagement;
import com.java.dao.PickingmanagementDao;
import com.java.service.PickingmanagementService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (Pickingmanagement)表服务实现类
 *
 * @author makejava
 * @since 2021-01-20 18:54:57
 */
@Service("pickingmanagementService")
public class PickingmanagementServiceImpl implements PickingmanagementService {
    @Resource
    private PickingmanagementDao pickingmanagementDao;

    /**
     * 通过ID查询单条数据
     *
     * @param pmId 主键
     * @return 实例对象
     */
    @Override
    public Pickingmanagement queryById(Integer pmId) {
        return this.pickingmanagementDao.queryById(pmId);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit 查询条数
     * @return 对象列表
     */
    @Override
    public List<Pickingmanagement> queryAllByLimit(int offset, int limit) {
        return this.pickingmanagementDao.queryAllByLimit(offset, limit);
    }

    /**
     * 新增数据
     *
     * @param pickingmanagement 实例对象
     * @return 实例对象
     */
    @Override
    public Pickingmanagement insert(Pickingmanagement pickingmanagement) {
        this.pickingmanagementDao.insert(pickingmanagement);
        return pickingmanagement;
    }

    /**
     * 修改数据
     *
     * @param pickingmanagement 实例对象
     * @return 实例对象
     */
    @Override
    public Pickingmanagement update(Pickingmanagement pickingmanagement) {
        this.pickingmanagementDao.update(pickingmanagement);
        return this.queryById(pickingmanagement.getPmId());
    }

    /**
     * 通过主键删除数据
     *
     * @param pmId 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer pmId) {
        return this.pickingmanagementDao.deleteById(pmId) > 0;
    }
}